import 'package:player_plugin/video_definition.dart';
import 'package:player_plugin/video_speed.dart';

/// 自定义播放参数
class VideoPlayOptions {
  VideoPlayOptions({
    this.aspectRatio = 16 / 9,
    this.startPosition = const Duration(seconds: 0),
    this.loop = false,
    this.seekSeconds = 15,
    this.progressGestureUnit = 1000,
    this.volumeGestureUnit = 0.005,
    this.brightnessGestureUnit = 0.005,
    this.autoplay = true,
    this.autoRotate = true,
    this.allowScrubbing = true,
    this.allowBackgroundPlayback = false,
    List<VideoSpeedItem>? speedList,
    this.definitionList = const [],
  }) : speedList = speedList ??
      [
        VideoSpeedItem(speed: 0.5, title: '0.5X'),
        VideoSpeedItem(speed: 0.75, title: '0.75X'),
        VideoSpeedItem(speed: 1.0, title: '1X'),
        VideoSpeedItem(speed: 1.25, title: '1.25X'),
        VideoSpeedItem(speed: 1.5, title: '1.5X'),
        VideoSpeedItem(speed: 1.75, title: '1.75X'),
        VideoSpeedItem(speed: 2.0, title: '2X'),
      ];

  /// 开始播放节点
  final Duration startPosition;

  /// 是否循环播放
  final bool loop;

  /// 视频快进秒数
  final int seekSeconds;

  /// 设置（横向）手势调节视频进度的毫秒数单位，默认为`1000ms`
  final int progressGestureUnit;

  /// 设置（右侧垂直）手势调节视频音量的单位，必须为0～1之间（不能小于0，不能大于1），默认为`0.01`
  final double volumeGestureUnit;

  /// 设置（左侧垂直）手势调节视频亮度的单位，必须为0～1之间（不能小于0，不能大于1），默认为`0.01`
  final double brightnessGestureUnit;

  /// 是否自动播放
  final bool autoplay;

  /// 是否开启自动旋转
  final bool autoRotate;

  /// 是否允许后台播放
  final bool allowBackgroundPlayback;

  /// 视频播放比例
  final double aspectRatio;

  /// 是否允许进度条拖拽
  final bool allowScrubbing;

  /// 倍数列表
  final List<VideoSpeedItem> speedList;

  /// 清晰度列表
  final List<VideoDefinitionItem> definitionList;
}
